#pragma once
#include "DXAMLCommon.h"
#include "XamlNamespace.h"
#include "XamlSchemaContext.h"
#include "XamlProperty.h"
#include "XamlType.h"

#include "XamlName.h"

//class ParserErrorReporter;
//class XamlType;
//class XamlName;
//class CXString;



class XamlContext
{
public:

	enum UsageMode
	{
		umParser,
		umBuilder,
		umSymbolTable
	};

public: 
	virtual HRESULT AddNamespacePrefix(const xshared_ptr<CXString> & inPrefix, const xshared_ptr<XamlNamespace> & spXamlNamespace) = 0;
	virtual HRESULT FindNamespaceByPrefix(const xshared_ptr<CXString> & inPrefix, xshared_ptr<XamlNamespace> & outNamespace) = 0;
	HRESULT get_SchemaContext(xshared_ptr<XamlSchemaContext> & outSchemaContext);
	HRESULT GetErrorService(xshared_ptr<ParserErrorReporter> & outErrorService);
protected: 
	HRESULT GetXamlType(const xshared_ptr<CXString> & inPrefix, const xshared_ptr<CXString> & inName, xshared_ptr<XamlNamespace> & outXamlNamespace, xshared_ptr<XamlType> & outXamlType);
public: 
	HRESULT GetXamlType(const xshared_ptr<XamlName> & inTypeName, xshared_ptr<XamlNamespace> & outXamlNamespace, xshared_ptr<XamlType> & outXamlType);
	HRESULT GetXamlType(const xshared_ptr<XamlName> & inTypeName, xshared_ptr<XamlType> & outXamlType);
	HRESULT GetXamlProperty(const xshared_ptr<XamlType> & inXamlType, const xshared_ptr<CXString> & inPropertyName, xshared_ptr<XamlProperty> & outXamlProperty);
	HRESULT GetXamlAttachableProperty(const xshared_ptr<XamlType> & inXamlType, const xshared_ptr<CXString> & inPropertyName, xshared_ptr<XamlProperty> & outXamlProperty);
protected: 
	XamlContext(const xshared_ptr<XamlSchemaContext> & inSchemaContext);
	virtual ~XamlContext();
	virtual HRESULT PopulateDefaultNamespaces();
private:
	xweak_ptr<XamlSchemaContext> m_SchemaContext;

};

